#ifndef RESIDUEWINDOW_H
#define RESIDUEWINDOW_H

#include "PDBManager.h"

class ResidueWindow : public wxPanel {
private:
	int width, height;
	PDBManager *pdbManager;
	MainWindow *mainWindow;

	wxComboBox *combo;
	wxListCtrl *list;

	int chainLocked;
	int activeChain;
	// Used in UpdateState to detect if UpdateResidueList call is needed.
	int lastActiveChain;

	// Updates residue list only.  No check if needed.
	void UpdateResidueList();
	void ChainSelected(wxCommandEvent& evt);
	//void UpdateSelected();
public:
	ResidueWindow(wxWindow *parent, MainWindow *mainWindow, PDBManager* pdbManager);
	~ResidueWindow();
	void OnSize(wxSizeEvent& evt);
	void UpdatePDB(PDBManager *pdbManager, int forceChain);

	void ChangeSelection(int chain, int index);

	void Selected(wxListEvent& evt);
	void UnSelected(wxListEvent& evt);

	// Updates residues, colors, and selection state
	// Residues left alone if already up to date.
	void UpdateDisplay(int jumpTo=-1, int jumpToChain=-1);

	void OnSelectAll(wxCommandEvent& evt);

	DECLARE_EVENT_TABLE()
};

#endif
